package com.htrq.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.htrq.dao.LNGFactoryDao;
import com.htrq.entity.LNGFactoryData;
import com.htrq.entity.Page;

@Service
@Transactional(value = "txManager")
public class LNGFacService {
	@Resource
	private LNGFactoryDao facDao;

	public List<LNGFactoryData> getAllfacs(LNGFactoryData facs, Page page) {
		// TODO Auto-generated method stub
		List<LNGFactoryData> list = facDao.getAllfacs(facs, page);
		for (LNGFactoryData fac : list) {
			fac.setUid(fac.getId() + "");
		}
		return list;
	}
	public Long getTotal(LNGFactoryData facs) {
		// TODO Auto-generated method stub
		return facDao.getTotal(facs);
	}
	public boolean modify(LNGFactoryData facs) {
		// TODO Auto-generated method stub
		try {
			// 加入公式计算部分
			facs.setFile11(facs.getFile8() + facs.getFile9() + facs.getFile10());// 全场用电量
			facs.setFile17(facs.getFile12() + facs.getFile13() + facs.getFile14() + facs.getFile15() + facs.getFile16());// 全园区用水量
			facDao.modify(facs);
			return true;
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
	}
}
